home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / macros / plain / contrib / mhack.tex < prev    next >
Encoding:
Text File  |  1992-08-30  |  4.7 KB  |  103 lines

  1. %% Save file as: MHACK.TEX              Source: FILESERV@SHSU.BITNET  
  2. %% Original author: Norman Walsh <walsh@cs.umass.edu>
  3. %% Original source: Posted to INFO-TeX@SHSU.edu by 
  4. %% RAY BROHINSKY <RAYBRO%HOLON@utrcgw.utc.com> on Fri, 27 Sep 1991 16:29 EDT
  5. %%
  6. %Here are two solutions for marginal hacks.  \ihack is based upon
  7. %the marginal hacks notes in the book and requires the section that
  8. %redefines \pagecontents.  It has the defect that marginal hacks
  9. %start at the top of the page rather than where you put them in the
  10. %text.
  11.  
  12. %\vhack doesn't use inserts and has the advantage that you don't
  13. %need to redefine part of the output routine (\pagecontents) but if
  14. %you put several hacks very close to each other, they may overlap.%
  15.  
  16. %Let me know what you think.  If you have try to integrate them into
  17. %your notes and you have trouble, just let me know.
  18.  
  19. % mhack.tex %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  20. \font\marginhackfont=cmr7
  21. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  22. \newinsert\margin
  23. \dimen\margin=\maxdimen
  24. \count\margin=0 \skip\margin=0pt
  25. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  26. \newdimen\marginhackwidth
  27. \newdimen\marginhackshift
  28. \newdimen\marginhacknudge
  29. \marginhackwidth=.8in
  30. \marginhackshift=\hsize
  31. \advance\marginhackshift by .1in
  32. \marginhacknudge=.1in
  33. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  34. \def\ihack#1{\marginhacknudge=0pt\insert\margin{\hbox{\marginhackpara{#1}}}}
  35. \def\vhack#1{\vadjust{\vbox to 0pt{%
  36.              \marginhacknudge=.1in%
  37.              \vskip-8.5pt% move it back up the page
  38.              \hskip6.2in\rlap{%
  39.              \marginhackpara{#1}}\vss}}}
  40. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  41. % this is a modified version of \para that I got
  42. % from ... somewhere
  43. %
  44. \long\def\marginhackpara#1{%            %
  45.    \hskip\marginhacknudge               %
  46.    \vtop{\leftskip=0pt\rightskip=0pt    % Make width ok
  47.    \hsize=\marginhackwidth              %
  48.    \marginhackfont                      % select font
  49.    \parindent=0pt                       %
  50.    \baselineskip=6pt                    %
  51.    \everypar={}                         %
  52.    \lineskip=1pt                        %
  53.    \lineskiplimit=1pt                   %
  54.    \raggedright                         %
  55.    \hbadness=10000                      % I don't care about underfull boxes
  56.    \tolerance=10000                     % I don't care about overfull ones
  57.    \noindent                            % don't indent
  58.    \vrule width0pt height8.5pt          % line up top of hack and text
  59.    #1\relax                             % add the text
  60.    \vrule width 0pt depth 7pt}%         % pad bottom of box
  61. }%
  62. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  63. % Include the marginal hacks in the plain output routine
  64. % (only needed for \ihack)
  65. \catcode`@=11
  66. \def\pagecontents{\ifvoid\topins\else\unvbox\topins\fi
  67.   \ifvoid\margin\else %
  68.     \rlap{\kern\marginhackshift\vbox to 0pt{\box\margin\vss}}\fi
  69.   \dimen@=\dp\@cclv \unvbox\@cclv % open up \box255
  70.   \ifvoid\footins\else % footnote info is present
  71.     \vskip\skip\footins
  72.     \footnoterule
  73.     \unvbox\footins\fi
  74.   \ifr@ggedbottom \kern-\dimen@ \vfil \fi}
  75. \catcode`@=12 % at signs are no longer letters
  76.  
  77. \endinput
  78. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  79. Here is some text followed by more text and more text and more text and
  80. more text and more text and more text and more text and more text and
  81. more text and more text and more text and more text and more text and
  82. more text and more text and more text and more text and more text and
  83. more text and more text and more text and more text and more text and
  84. more text and more text and more text and more text and more text and
  85. more text and more text and more text and more text and more text and
  86. more text and more text and more text and more text and more text and
  87. more text and more text and more text and more text and more text and
  88. more text and more text and VHACK\vhack{this is a vhack, it starts
  89. here and goes on for several lines} more text and more text and
  90. more text and more text and more text and more text and more text and
  91. more VHACK\vhack{this is another vhack, which collides}
  92. and more text and more text and more text and more text and
  93. more text and more IHACK\ihack{this is an ihack, it starts at the top}
  94. and more text and more text and more
  95. IHACK\ihack{this is a second ihack, but it doesn't collide}
  96. and  more text and more text and more text and more text and more text and
  97. more text and more text and more text and more text and more text and
  98. more text and more text and more text and more text and more text and
  99. more text and more text and more text and more text and more text and
  100. more text and more text and more text and more text and more text.
  101. \bye
  102. % end of mhack.tex %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  103.